package com.freely.domain;

import java.util.Date;

/**
 *  message_id			bigint		primary key		not null	消息通知id
	receiver_id			bigint		foreign key		not null	接收人id
	sender_id			bigint		foreign key					发送人id
	group_id			Bigint		foreign key					群id
	message_type		int							not null	消息类型（0为普通消息，1为群邀请，2为群审核）
	message_result		Int							not null	操作结果（0为为操作，1为同意，2为拒绝） 
	message_title		varchar(20)					not null	消息标题
	message_content		varchar(50)					not null	消息内容
	message_send_time	timestamp					not null	发送时间
	message_read		bool						not null	是否已读

 * @author Administrator
 *
 */
public class Message {
	private Long message_id;				// 消息通知id
	private Integer message_type;			// 消息类型（0为普通消息，1为群邀请，2为群审核）
 	private Integer message_result;			// 操作结果（0为未操作，1为同意，2为拒绝）
 	private String message_title;			// 消息标题
 	private String message_content;			// 消息内容
 	private Date message_send_time;			// 发送时间
 	private Boolean message_read;			// 是否已读
 	
 	private User sender;					// 发送人
 	private User receiver;					// 接收人
 	private Group group;					// 群
 		
	public Long getMessage_id() {
		return message_id;
	}
	public void setMessage_id(Long message_id) {
		this.message_id = message_id;
	}
	public Integer getMessage_type() {
		return message_type;
	}
	public void setMessage_type(Integer message_type) {
		this.message_type = message_type;
	}
	public Integer getMessage_result() {
		return message_result;
	}
	public void setMessage_result(Integer message_result) {
		this.message_result = message_result;
	}
	public String getMessage_title() {
		return message_title;
	}
	public void setMessage_title(String message_title) {
		this.message_title = message_title;
	}
	public String getMessage_content() {
		return message_content;
	}
	public void setMessage_content(String message_content) {
		this.message_content = message_content;
	}
	public Date getMessage_send_time() {
		return message_send_time;
	}
	public void setMessage_send_time(Date message_send_time) {
		this.message_send_time = message_send_time;
	}
	public Boolean getMessage_read() {
		return message_read;
	}
	public void setMessage_read(Boolean message_read) {
		this.message_read = message_read;
	}
	public User getSender() {
		return sender;
	}
	public void setSender(User sender) {
		this.sender = sender;
	}
	public User getReceiver() {
		return receiver;
	}
	public void setReceiver(User receiver) {
		this.receiver = receiver;
	}
	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Message [message_id=" + message_id + ", message_type=" + message_type + ", message_result="
				+ message_result + ", message_title=" + message_title + ", message_content=" + message_content
				+ ", message_send_time=" + message_send_time + ", message_read=" + message_read + "]");
		if(this.getSender() != null) {
			sb.append("sender name = " + this.getSender().getUser_name() + "  ");
		}
		if(this.getReceiver() != null) {
			sb.append("receiver name = " + this.getReceiver().getUser_name() + "  ");
		}
		if(this.getGroup() != null) {
			sb.append("group name = " + this.getGroup().getGroup_name() + "  ");
		}
		return sb.toString();
	}
}
